package com.booking.springrestful.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 咨询室时间安排
 * @TableName timeslot
 */
@TableName(value ="timeslot")
@Data
public class Timeslot implements Serializable {
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Integer timeSlotId;

    /**
     * 开始时间
     */
    private Date startTime;

    /**
     * 结束时间
     */
    private Date endTime;

    /**
     * 该时间段关联的咨询师
     */
    private Integer counselorid;

    /**
     * 是否可用
     */
    private Integer isAvailable;

    /**
     * 咨询室id
     */
    private Integer consultationRoomId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Timeslot other = (Timeslot) that;
        return (this.getTimeSlotId() == null ? other.getTimeSlotId() == null : this.getTimeSlotId().equals(other.getTimeSlotId()))
            && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
            && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
            && (this.getCounselorid() == null ? other.getCounselorid() == null : this.getCounselorid().equals(other.getCounselorid()))
            && (this.getIsAvailable() == null ? other.getIsAvailable() == null : this.getIsAvailable().equals(other.getIsAvailable()))
            && (this.getConsultationRoomId() == null ? other.getConsultationRoomId() == null : this.getConsultationRoomId().equals(other.getConsultationRoomId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getTimeSlotId() == null) ? 0 : getTimeSlotId().hashCode());
        result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
        result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
        result = prime * result + ((getCounselorid() == null) ? 0 : getCounselorid().hashCode());
        result = prime * result + ((getIsAvailable() == null) ? 0 : getIsAvailable().hashCode());
        result = prime * result + ((getConsultationRoomId() == null) ? 0 : getConsultationRoomId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", timeSlotId=").append(timeSlotId);
        sb.append(", startTime=").append(startTime);
        sb.append(", endTime=").append(endTime);
        sb.append(", counselorid=").append(counselorid);
        sb.append(", isAvailable=").append(isAvailable);
        sb.append(", consultationRoomId=").append(consultationRoomId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}